<?php
$path = str_replace('cron/notify_admin_user', '', str_replace('\\', '/', getcwd()));

require_once $path . 'config.inc.php';
require_once APP_ROOT_DIR . 'cron/common_cron.php';
require_once APP_ROOT_DIR . 'cron/notify_admin_user/Sender.php';

$sender = &new Sender();
$last_sent = $sender->readLastRun();

if($last_sent && $sender->isFreshArticles($last_sent)) {

	$sender->log('STARTED');
	
	$file = APP_ROOT_DIR . 'cron/notify_admin_user/background_send.php run';
	$cmd = $conf['php_path'] . $file . " 2>&1 > cron_check.log &";
	$last_line = exec($cmd, $retval);
		
	//header("location: " . $_SERVER['PHP_SELF'] . "?lanched=1");
	exit();
}
?>